package com.wendy.utils.date;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.wendy.utils.Constants;
import com.wendy.utils.DateUtil;

import java.io.IOException;
import java.util.Date;

/**
 * @author zhuwending
 */
public class DateJsonDeserializer extends JsonDeserializer<Date> {
    @Override
    public Date deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException {
        return DateUtil.convert2Date(jsonParser.getText(), Constants.YYYY_MM_DD);
    }
}
